package com.vsu.bookstore;

import com.vaadin.Application;
import com.vaadin.ui.Window;
import com.vsu.bookstore.mvc.ui.widgetcontainers.UiHandler;
import com.vsu.bookstore.util.UserSession;

@SuppressWarnings("serial")
public class BookstoreApplication extends Application
{
  private final UserSession session = new UserSession();

  public UserSession getSession()
  {
    return session;
  }

  @Override
  public void init()
  {
    setTheme("bookstoretheme");
    final Window mainWindow = new Window();
    setMainWindow(mainWindow);
    initUi();
  }

  private void initUi()
  {
    final UiHandler ui =  new UiHandler();
    getMainWindow().setContent(ui);
  }

  public UiHandler ui()
  {
    return (UiHandler)getMainWindow().getContent();
  }
}
